(function(){
        // 搜索框切换
        const searchToggle = document.getElementById('search-toggle');
        const searchBox = document.getElementById('search-box');
        let searchOpen = false;

        searchToggle.addEventListener('click', function () {
            if (searchOpen) {
                searchBox.style.height = '0';
            } else {
                searchBox.style.height = searchBox.scrollHeight + 'px';
                // 自动聚焦搜索框
                setTimeout(() => {
                    const searchInput = searchBox.querySelector('input');
                    if (searchInput) searchInput.focus();
                }, 300);
            }
            searchOpen = !searchOpen;
        });
})();
